/*
 *此javaCode由YMS-JDBC替换工具生成，原mapper位置com.yonyou.ucf.mdf.app.isvdxq.other.mapper.ProductSKUMapper
 */
package com.yonyou.ucf.mdf.app.isvdxq.other.mapper.impl;

import com.yonyou.iuap.yms.api.IYmsJdbcApi;
import com.yonyou.iuap.yms.param.*;
import com.yonyou.iuap.yms.param.ResultSetProcessor;
import com.yonyou.iuap.yms.processor.*;
import com.yonyou.ucf.mdf.app.isvdxq.other.entity.ProductSKUEntity;
import java.sql.Types;
import java.util.*;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

@Repository
public class ProductSKUMapperImpl  {
    
    @Autowired
    private IYmsJdbcApi ymsJdbcApi;
    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.ProductSKUMapper.selectAll
    
    public List<ProductSKUEntity> selectAll(String tenantId) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxqyy_productsku where `isEnabled`='true' and `ytenant_id`=?;\n";
        parameter.addParam(tenantId);

        ResultSetProcessor processor = new AutoBeanListProcessor(new ProductSKUEntity());
        return (List<ProductSKUEntity>) ymsJdbcApi.queryForList(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.ProductSKUMapper.updateByPrimaryKey
    
    public int updateByPrimaryKey(ProductSKUEntity record) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "update dxqyy_productsku set `type` = ?, `sourcetype` = ?, `showItemName` = ?, `userdefAliasName` = ?, `isSerInput` = ?, `isWebShow` = ?, `isEnabled` = ?, `orderNum` = ?, `userdefMode` = ?, `maxInputLen` = ?, `decimalDigits` = ? where `id` = ?\n";
        parameter.addParamWithType(record.getType(), Types.VARCHAR);
		parameter.addParamWithType(record.getSourcetype(), Types.VARCHAR);
		parameter.addParamWithType(record.getShowItemName(), Types.VARCHAR);
		parameter.addParamWithType(record.getUserdefAliasName(), Types.VARCHAR);
		parameter.addParamWithType(record.getIsSerInput(), Types.VARCHAR);
		parameter.addParamWithType(record.getIsWebShow(), Types.VARCHAR);
		parameter.addParamWithType(record.getIsEnabled(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrderNum(), Types.INTEGER);
		parameter.addParamWithType(record.getUserdefMode(), Types.INTEGER);
		parameter.addParamWithType(record.getMaxInputLen(), Types.INTEGER);
		parameter.addParamWithType(record.getDecimalDigits(), Types.INTEGER);
		parameter.addParamWithType(record.getId(), Types.BIGINT);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.ProductSKUMapper.insert
    
    public int insert(ProductSKUEntity record) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "insert into dxqyy_productsku (`id`, `type`,  `sourcetype`, `showItemName`,  `userdefAliasName`, `isSerInput`,  `isWebShow`, `isEnabled`,  `orderNum`, `userdefMode`,  `maxInputLen`, `decimalDigits`, `ytenant_id`) values (?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?,  ?, ?, ?)\n";
        parameter.addParamWithType(record.getId(), Types.BIGINT);
		parameter.addParamWithType(record.getType(), Types.VARCHAR);
		parameter.addParamWithType(record.getSourcetype(), Types.VARCHAR);
		parameter.addParamWithType(record.getShowItemName(), Types.VARCHAR);
		parameter.addParamWithType(record.getUserdefAliasName(), Types.VARCHAR);
		parameter.addParamWithType(record.getIsSerInput(), Types.VARCHAR);
		parameter.addParamWithType(record.getIsWebShow(), Types.VARCHAR);
		parameter.addParamWithType(record.getIsEnabled(), Types.VARCHAR);
		parameter.addParamWithType(record.getOrderNum(), Types.INTEGER);
		parameter.addParamWithType(record.getUserdefMode(), Types.INTEGER);
		parameter.addParamWithType(record.getMaxInputLen(), Types.INTEGER);
		parameter.addParamWithType(record.getDecimalDigits(), Types.INTEGER);
		parameter.addParamWithType(record.getTenant_id(), Types.VARCHAR);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.ProductSKUMapper.selectCount
    
    public int selectCount(long id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select count(1) from dxqyy_productsku where `id`=?;\n";
        parameter.addParam(id);

        ResultSetProcessor processor = new ColumnProcessor(int.class);
        return (int) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.ProductSKUMapper.deleteByPrimaryKey
    
    public int deleteByPrimaryKey(Long id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "delete from dxqyy_productsku where `id` = ?\n";
        parameter.addParamWithType(id, Types.BIGINT);

        
        return ymsJdbcApi.update(sql, parameter);
    }

    //com.yonyou.ucf.mdf.app.isvdxq.other.mapper.ProductSKUMapper.selectById
    
    public ProductSKUEntity selectById(long id) {
        SQLParameter parameter = new SQLParameter(true);
        
        String sql = "select * from dxqyy_productsku where `id`=?;\n";
        parameter.addParam(id);

        ResultSetProcessor processor = new AutoBeanProcessor(new ProductSKUEntity());
        return (ProductSKUEntity) ymsJdbcApi.queryForObject(sql, parameter, processor);
    }

}
